<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>常德前列腺医院管理系统</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
  <link rel="stylesheet" href="css/bootstrap.min.css">
  <link rel="stylesheet" href="css/font-awesome.min.css">
  <link rel="stylesheet" href="css/AdminLTE.min.css">
  <!-- AdminLTE Skins. Choose a skin from the css/skins
       folder instead of downloading all of them to reduce the load. -->
  <link rel="stylesheet" href="css/all-skins.min.css">
  <link rel="stylesheet" href="css/style.css">
  <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
  <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  <!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  <![endif]-->
</head>
<!--<body class="hold-transition login-page">-->
<!--<div class="login-box" id="rrapp" v-cloak>-->
  <!--<div class="login-logo">-->
    <!--<b>常德前列腺医院后台</b>-->
  <!--</div>-->
  <!--&lt;!&ndash; /.login-logo &ndash;&gt;-->
  <!--<div class="login-box-body">-->
      <!--<div v-if="error" class="alert alert-danger alert-dismissible">-->
        <!--<h4 style="margin-bottom: 0px;"><i class="fa fa-exclamation-triangle"></i> {{errorMsg}}</h4>-->
      <!--</div>-->
      <!--<div class="form-group has-feedback">-->
          <!--<input type="text" class="form-control" v-model="username" placeholder="账号">-->
          <!--<span class="glyphicon glyphicon-user form-control-feedback"></span>-->
      <!--</div>-->
      <!--<div class="form-group has-feedback">-->
          <!--<input type="password" class="form-control" v-model="password" @keyup.enter="login" placeholder="密码">-->
          <!--<span class="glyphicon glyphicon-lock form-control-feedback"></span>-->
      <!--</div>-->

      <!--<div class="row">-->
        <!--<div class="col-xs-8">-->
          <!--<div class="checkbox icheck">-->
          <!--</div>-->
        <!--</div>-->
        <!--&lt;!&ndash; /.col &ndash;&gt;-->
        <!--<div class="col-xs-4">-->
          <!--<button type="button" class="btn btn-primary btn-block btn-flat" @click="login">登录</button>-->
        <!--</div>-->
        <!--&lt;!&ndash; /.col &ndash;&gt;-->
      <!--</div>-->
    <!--&lt;!&ndash; /.social-auth-links &ndash;&gt;-->

  <!--</div>-->
  <!--&lt;!&ndash; /.login-box-body &ndash;&gt;-->
<!--</div>-->
<!--&lt;!&ndash; /.login-box &ndash;&gt;-->

<body class="gray-bg">

<div class="middle-box text-center loginscreen  animated fadeInDown">
    <div>
        <div>

            <h1 class="logo-name">ZS</h1>

        </div>
        <h3>医院后台管理系统</h3>

        <form class="m-t" role="form" id="rrapp" v-cloak>
            <div class="login-box-body">
                <div v-if="error" class="alert alert-danger alert-dismissible">
                <h4 style="margin-bottom: 0px;"><i class="fa fa-exclamation-triangle"></i> {{errorMsg}}</h4>
                </div>
            <div class="form-group">
                <input type="text" class="form-control" placeholder="用户名" v-model="username" required="">
                <span class="glyphicon glyphicon-user form-control-feedback"></span>
            </div>
            <div class="form-group">
                <input type="password" class="form-control" v-model="password" @keyup.enter="login" placeholder="密码" required="">
                <span class="glyphicon glyphicon-lock form-control-feedback"></span>
            </div>
                <div class="row">
                <div class="col-xs-8">
                <div class="checkbox icheck">
                </div>
                </div>
            <button type="button" class="btn btn-primary btn-block btn-flat" @click="login">登 录</button>

        </form>
    </div>
</div>

<script src="libs/jquery.min.js"></script>
<script src="plugins/jqgrid/jquery.jqGrid.min.js"></script>
<script src="libs/vue.min.js"></script>
<script src="libs/bootstrap.min.js"></script>
<script src="libs/app.js"></script>
<script src="js/common.js"></script>
<script type="text/javascript">
var vm = new Vue({
	el:'#rrapp',
	data:{
		username: '',
		password: '',
		error: false,
		errorMsg: ''
	},
	beforeCreate: function(){
		if(self != top){
			top.location.href = self.location.href;
		}
	},
	methods: {
		login: function () {
            var data = "username="+vm.username+"&password="+vm.password;
			$.ajax({
				type: "POST",
			    url: baseURL + "sys/login",
			    data: data,
			    dataType: "json",
			    success: function(r){
					if(r.code == 0){//登录成功
                        localStorage.setItem("token", r.token);
                        parent.location.href ='index.html';
					}else{
						vm.error = true;
						vm.errorMsg = r.msg;
					}
				}
			});
		}
	}
});
</script>
</body>
</html>
